import java.util.*;

/**
 * @author LKQ
 * @date 2022/3/8 14:09
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] h = {3}, v = {3};
        solution.maxArea(5, 4, h, v);
    }
    public int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {
        int m = horizontalCuts.length, n = verticalCuts.length;
        Arrays.sort(horizontalCuts);
        Arrays.sort(verticalCuts);
        long height , width ;
        height = Math.max(horizontalCuts[0], h - horizontalCuts[m -1]);
        width = Math.max(verticalCuts[0], w - verticalCuts[n-1]);

        for (int i = 0; i < m - 1; i++) {
            height = Math.max(height, horizontalCuts[i + 1] - horizontalCuts[i]);
        }
        for (int j = 0; j < n - 1; j++) {
            width = Math.max(width, verticalCuts[j + 1] - verticalCuts[j]);
        }
        return (int) ((width * height) % 1_000_000_007);
    }
}
